﻿using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour {
	public float _movementSpeed = 3f;

	public int _dmg = 1;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		this.transform.position = new Vector3(this.transform.position.x - Time.deltaTime * this._movementSpeed, this.transform.position.y, this.transform.position.z);
		
		// player reached
		if (this.transform.position.x < -6.5f)
		{
			GameObject.Find("TheDude").GetComponent<PlayerHealth>().HitPlayer(this._dmg);
			Destroy (this.gameObject);
		}
	}
}
